package com.adcc.swingui.demo.menubar;

import java.awt.Container;
import java.util.List;

import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;

import com.adcc.swingui.base.DefaultMenuBar;
import com.jidesoft.swing.JideMenu;
/**
 * 工具栏
 * @author Administrator
 *
 */
public class ToolMenuBut extends DefaultMenuBar {

	JMenu menu;
	
	JMenuItem distanceItem;
	JMenuItem objmanageItem;
	JMenuItem sentmsgItem;
	JMenuItem showItem;
	
	public ToolMenuBut(Container container) {
		super(container);
	}

	@Override
	protected JComponent build() {
		// TODO Auto-generated method stub
		
		menu = new JideMenu("工具");
		menu.setMnemonic('T');
		
		//测距
		distanceItem=new JMenuItem("测距",new ImageIcon("res/images/distance.png"));
		addChildMenu(menu, distanceItem, "measureDistance",true);
		
		//对象管理
		objmanageItem=new JMenuItem("对象管理",new ImageIcon("res/images/13.png"));
		addChildMenu(menu, objmanageItem, "objManage",true);
		
		//发送报文
		sentmsgItem = new JMenuItem("发送报文",new ImageIcon("res/images/set_msg.png"));
		addChildMenu(menu, sentmsgItem, "sendUpMsg",true);
		
		// 分割符
		menu.addSeparator();
		
		//显示设置
		showItem = new JMenuItem("显示设置",new ImageIcon("res/images/8.png"));
		addChildMenu(menu, showItem, "AtmosphereManagement",true);
		
		return menu;
	}
	
	/**
	 * 测距
	 */
	public void measureDistance() {
		System.out.println("distance");
	}
	
	/**
	 * 对象管理
	 */
	public void objManage() {
		System.out.println("manage");
	}
	
	/**
	 * 发送报文
	 */
	public void sendUpMsg() {
		System.out.println("sendmasg");
	}
	
	/**
	 * 显示设置
	 */
	public void AtmosphereManagement() {
		System.out.println("atmosp");
	}

	@Override
	protected void offLineVisiable(List<JComponent> jcomps) {
		// TODO Auto-generated method stub
		
	}
}
